3.24.67 \(\int \frac {A+B x}{a+b x+c x^2} \, dx\) [2367]

Optimal. Leaf size=64 \[ \frac {(b B-2 A c) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c \sqrt {b^2-4 a c}}+\frac {B \log \left (a+b x+c x^2\right )}{2 c} \]

[Out]

1/2*B*ln(c*x^2+b*x+a)/c+(-2*A*c+B*b)*arctanh((2*c*x+b)/(-4*a*c+b^2)^(1/2))/c/(-4*a*c+b^2)^(1/2)

________________________________________________________________________________________

Rubi [A]
time = 0.03, antiderivative size = 64, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 18, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.222, Rules used = {648, 632, 212, 642} \begin {gather*} \frac {(b B-2 A c) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c \sqrt {b^2-4 a c}}+\frac {B \log \left (a+b x+c x^2\right )}{2 c} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(A + B*x)/(a + b*x + c*x^2),x]

[Out]

((b*B - 2*A*c)*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])/(c*Sqrt[b^2 - 4*a*c]) + (B*Log[a + b*x + c*x^2])/(2*c)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 642

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[d*(Log[RemoveContent[a + b*x +
c*x^2, x]]/b), x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rule 648

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rubi steps

\begin {align*} \int \frac {A+B x}{a+b x+c x^2} \, dx &=\frac {B \int \frac {b+2 c x}{a+b x+c x^2} \, dx}{2 c}+\frac {(-b B+2 A c) \int \frac {1}{a+b x+c x^2} \, dx}{2 c}\\ &=\frac {B \log \left (a+b x+c x^2\right )}{2 c}-\frac {(-b B+2 A c) \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c}\\ &=\frac {(b B-2 A c) \tanh ^{-1}\left (\frac {b+2 c x}{\sqrt {b^2-4 a c}}\right )}{c \sqrt {b^2-4 a c}}+\frac {B \log \left (a+b x+c x^2\right )}{2 c}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.04, size = 66, normalized size = 1.03 \begin {gather*} \frac {-\frac {2 (b B-2 A c) \tan ^{-1}\left (\frac {b+2 c x}{\sqrt {-b^2+4 a c}}\right )}{\sqrt {-b^2+4 a c}}+B \log (a+x (b+c x))}{2 c} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(A + B*x)/(a + b*x + c*x^2),x]

[Out]

((-2*(b*B - 2*A*c)*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]])/Sqrt[-b^2 + 4*a*c] + B*Log[a + x*(b + c*x)])/(2*c)

________________________________________________________________________________________

Maple [A]
time = 0.06, size = 62, normalized size = 0.97

method result size
default \(\frac {B \ln \left (c \,x^{2}+b x +a \right )}{2 c}+\frac {2 \left (A -\frac {B b}{2 c}\right ) \arctan \left (\frac {2 c x +b}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}\) \(62\)
risch \(\frac {2 \ln \left (8 a A \,c^{2}-2 A \,b^{2} c -4 a b B c +b^{3} B -2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, c x -\sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, b \right ) a B}{4 a c -b^{2}}-\frac {\ln \left (8 a A \,c^{2}-2 A \,b^{2} c -4 a b B c +b^{3} B -2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, c x -\sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, b \right ) b^{2} B}{2 c \left (4 a c -b^{2}\right )}+\frac {\ln \left (8 a A \,c^{2}-2 A \,b^{2} c -4 a b B c +b^{3} B -2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, c x -\sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, b \right ) \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}}{2 c \left (4 a c -b^{2}\right )}+\frac {2 \ln \left (8 a A \,c^{2}-2 A \,b^{2} c -4 a b B c +b^{3} B +2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, c x +\sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, b \right ) a B}{4 a c -b^{2}}-\frac {\ln \left (8 a A \,c^{2}-2 A \,b^{2} c -4 a b B c +b^{3} B +2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, c x +\sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, b \right ) b^{2} B}{2 c \left (4 a c -b^{2}\right )}-\frac {\ln \left (8 a A \,c^{2}-2 A \,b^{2} c -4 a b B c +b^{3} B +2 \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, c x +\sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}\, b \right ) \sqrt {-\left (4 a c -b^{2}\right ) \left (2 A c -b B \right )^{2}}}{2 c \left (4 a c -b^{2}\right )}\) \(661\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B*x+A)/(c*x^2+b*x+a),x,method=_RETURNVERBOSE)

[Out]

1/2*B*ln(c*x^2+b*x+a)/c+2*(A-1/2*B*b/c)/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)/(4*a*c-b^2)^(1/2))

________________________________________________________________________________________

Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x^2+b*x+a),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

________________________________________________________________________________________

Fricas [A]
time = 2.03, size = 207, normalized size = 3.23 \begin {gather*} \left [-\frac {{\left (B b - 2 \, A c\right )} \sqrt {b^{2} - 4 \, a c} \log \left (\frac {2 \, c^{2} x^{2} + 2 \, b c x + b^{2} - 2 \, a c - \sqrt {b^{2} - 4 \, a c} {\left (2 \, c x + b\right )}}{c x^{2} + b x + a}\right ) - {\left (B b^{2} - 4 \, B a c\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c - 4 \, a c^{2}\right )}}, \frac {2 \, {\left (B b - 2 \, A c\right )} \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c x + b\right )}}{b^{2} - 4 \, a c}\right ) + {\left (B b^{2} - 4 \, B a c\right )} \log \left (c x^{2} + b x + a\right )}{2 \, {\left (b^{2} c - 4 \, a c^{2}\right )}}\right ] \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x^2+b*x+a),x, algorithm="fricas")

[Out]

[-1/2*((B*b - 2*A*c)*sqrt(b^2 - 4*a*c)*log((2*c^2*x^2 + 2*b*c*x + b^2 - 2*a*c - sqrt(b^2 - 4*a*c)*(2*c*x + b))
/(c*x^2 + b*x + a)) - (B*b^2 - 4*B*a*c)*log(c*x^2 + b*x + a))/(b^2*c - 4*a*c^2), 1/2*(2*(B*b - 2*A*c)*sqrt(-b^
2 + 4*a*c)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*x + b)/(b^2 - 4*a*c)) + (B*b^2 - 4*B*a*c)*log(c*x^2 + b*x + a))/(b^
2*c - 4*a*c^2)]

________________________________________________________________________________________

Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 280 vs. \(2 (58) = 116\).
time = 0.42, size = 280, normalized size = 4.38 \begin {gather*} \left (\frac {B}{2 c} - \frac {\left (- 2 A c + B b\right ) \sqrt {- 4 a c + b^{2}}}{2 c \left (4 a c - b^{2}\right )}\right ) \log {\left (x + \frac {- A b + 2 B a - 4 a c \left (\frac {B}{2 c} - \frac {\left (- 2 A c + B b\right ) \sqrt {- 4 a c + b^{2}}}{2 c \left (4 a c - b^{2}\right )}\right ) + b^{2} \left (\frac {B}{2 c} - \frac {\left (- 2 A c + B b\right ) \sqrt {- 4 a c + b^{2}}}{2 c \left (4 a c - b^{2}\right )}\right )}{- 2 A c + B b} \right )} + \left (\frac {B}{2 c} + \frac {\left (- 2 A c + B b\right ) \sqrt {- 4 a c + b^{2}}}{2 c \left (4 a c - b^{2}\right )}\right ) \log {\left (x + \frac {- A b + 2 B a - 4 a c \left (\frac {B}{2 c} + \frac {\left (- 2 A c + B b\right ) \sqrt {- 4 a c + b^{2}}}{2 c \left (4 a c - b^{2}\right )}\right ) + b^{2} \left (\frac {B}{2 c} + \frac {\left (- 2 A c + B b\right ) \sqrt {- 4 a c + b^{2}}}{2 c \left (4 a c - b^{2}\right )}\right )}{- 2 A c + B b} \right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x**2+b*x+a),x)

[Out]

(B/(2*c) - (-2*A*c + B*b)*sqrt(-4*a*c + b**2)/(2*c*(4*a*c - b**2)))*log(x + (-A*b + 2*B*a - 4*a*c*(B/(2*c) - (
-2*A*c + B*b)*sqrt(-4*a*c + b**2)/(2*c*(4*a*c - b**2))) + b**2*(B/(2*c) - (-2*A*c + B*b)*sqrt(-4*a*c + b**2)/(
2*c*(4*a*c - b**2))))/(-2*A*c + B*b)) + (B/(2*c) + (-2*A*c + B*b)*sqrt(-4*a*c + b**2)/(2*c*(4*a*c - b**2)))*lo
g(x + (-A*b + 2*B*a - 4*a*c*(B/(2*c) + (-2*A*c + B*b)*sqrt(-4*a*c + b**2)/(2*c*(4*a*c - b**2))) + b**2*(B/(2*c
) + (-2*A*c + B*b)*sqrt(-4*a*c + b**2)/(2*c*(4*a*c - b**2))))/(-2*A*c + B*b))

________________________________________________________________________________________

Giac [A]
time = 0.80, size = 63, normalized size = 0.98 \begin {gather*} \frac {B \log \left (c x^{2} + b x + a\right )}{2 \, c} - \frac {{\left (B b - 2 \, A c\right )} \arctan \left (\frac {2 \, c x + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c} c} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x^2+b*x+a),x, algorithm="giac")

[Out]

1/2*B*log(c*x^2 + b*x + a)/c - (B*b - 2*A*c)*arctan((2*c*x + b)/sqrt(-b^2 + 4*a*c))/(sqrt(-b^2 + 4*a*c)*c)

________________________________________________________________________________________

Mupad [B]
time = 0.12, size = 162, normalized size = 2.53 \begin {gather*} \frac {2\,A\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )}{\sqrt {4\,a\,c-b^2}}-\frac {B\,b^2\,\ln \left (c\,x^2+b\,x+a\right )}{2\,\left (4\,a\,c^2-b^2\,c\right )}+\frac {2\,B\,a\,c\,\ln \left (c\,x^2+b\,x+a\right )}{4\,a\,c^2-b^2\,c}-\frac {B\,b\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,x}{\sqrt {4\,a\,c-b^2}}\right )}{c\,\sqrt {4\,a\,c-b^2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((A + B*x)/(a + b*x + c*x^2),x)

[Out]

(2*A*atan(b/(4*a*c - b^2)^(1/2) + (2*c*x)/(4*a*c - b^2)^(1/2)))/(4*a*c - b^2)^(1/2) - (B*b^2*log(a + b*x + c*x
^2))/(2*(4*a*c^2 - b^2*c)) + (2*B*a*c*log(a + b*x + c*x^2))/(4*a*c^2 - b^2*c) - (B*b*atan(b/(4*a*c - b^2)^(1/2
) + (2*c*x)/(4*a*c - b^2)^(1/2)))/(c*(4*a*c - b^2)^(1/2))

________________________________________________________________________________________